import { Link } from 'dva/router';

let buttonStyle = {
  width: 200,
  height: 300,
  marginLeft: 500,
  padding: 40,
  border: '1px solid #ccc',
  boxShadow: '0 0 20px #ccc',
}

const Counter = (props) => {
  console.log(props)
  return (
    <div style={ buttonStyle }>
      <div>
        <div>当前计数: </div>
        {props.count}
      </div>
      <div>
        <div>上次计数: </div>
        {props.lastCount}
      </div>
      <button style={ {marginTop:'20px',color: 'green',width: '60px', height: '30px'}} onClick={() => props.dispatch({type: 'count/add'})}>+</button>
      <button style={ {marginTop:'20px',color: 'green',width: '60px', height: '30px', marginLeft: '5px'}} onClick={() => props.dispatch({type: 'count/minus'})}>-</button>
      <div onClick={() => props.dispatch({type: 'count/getData'})}>点击我获取数据显示：
      <div style={ {marginTop:'20px', color: 'green'}}>{props.asyncData}</div>
      </div>
      <div style={ {marginTop:'20px'}}>
        <Link to='/secondpage'>点击跳转页面</Link>
      </div>
    </div>
  );
};

Counter.propTypes = {
};

export default Counter;
